1 /*
2  * This file is part of gtkD.
3  *
4  * gtkD is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License
6  * as published by the Free Software Foundation; either version 3
7  * of the License, or (at your option) any later version, with
8  * some exceptions, please read the COPYING file.
9  *
10  * gtkD is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  * GNU Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General Public License
16  * along with gtkD; if not, write to the Free Software
17  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA
18  */
19 
20 // generated automatically - do not change
21 // find conversion definition on APILookup.txt
22 // implement new conversion functionalities on the wrap.utils pakage
23 
24 
25 module gtk.Snapshot;
26 
27 private import cairo.Context;
28 private import gdk.PaintableIF;
29 private import gdk.RGBA;
30 private import gdk.Snapshot : DGdkSnapshot = Snapshot;
31 private import gdk.Texture;
32 private import glib.Bytes;
33 private import glib.ConstructionException;
34 private import glib.Str;
35 private import gobject.ObjectG;
36 private import graphene.Matrix;
37 private import graphene.Point;
38 private import graphene.Point3D;
39 private import graphene.Rect;
40 private import graphene.Size;
41 private import graphene.Vec3;
42 private import graphene.Vec4;
43 private import gsk.GLShader;
44 private import gsk.RenderNode;
45 private import gsk.RoundedRect;
46 private import gsk.Transform;
47 private import gtk.StyleContext;
48 private import gtk.c.functions;
49 public  import gtk.c.types;
50 private import pango.PgLayout;
51 
52 
53 /**
54  * `GtkSnapshot` assists in creating [class@Gsk.RenderNode]s for widgets.
55  * 
56  * It functions in a similar way to a cairo context, and maintains a stack
57  * of render nodes and their associated transformations.
58  * 
59  * The node at the top of the stack is the one that `gtk_snapshot_append_…()`
60  * functions operate on. Use the `gtk_snapshot_push_…()` functions and
61  * [method@Snapshot.pop] to change the current node.
62  * 
63  * The typical way to obtain a `GtkSnapshot` object is as an argument to
64  * the [vfunc@Gtk.Widget.snapshot] vfunc. If you need to create your own
65  * `GtkSnapshot`, use [ctor@Gtk.Snapshot.new].
66  */
67 public class Snapshot : DGdkSnapshot
68 {
69 	/** the main Gtk struct */
70 	protected GtkSnapshot* gtkSnapshot;
71 
72 	/** Get the main Gtk struct */
73 	public GtkSnapshot* getGtkSnapshotStruct(bool transferOwnership = false)
74 	{
75 		if (transferOwnership)
76 			ownedRef = false;
77 		return gtkSnapshot;
78 	}
79 
80 	/** the main Gtk struct as a void* */
81 	protected override void* getStruct()
82 	{
83 		return cast(void*)gtkSnapshot;
84 	}
85 
86 	/**
87 	 * Sets our main struct and passes it to the parent class.
88 	 */
89 	public this (GtkSnapshot* gtkSnapshot, bool ownedRef = false)
90 	{
91 		this.gtkSnapshot = gtkSnapshot;
92 		super(cast(GdkSnapshot*)gtkSnapshot, ownedRef);
93 	}
94 
95 
96 	/** */
97 	public static GType getType()
98 	{
99 		return gtk_snapshot_get_type();
100 	}
101 
102 	/**
103 	 * Creates a new `GtkSnapshot`.
104 	 *
105 	 * Returns: a newly-allocated `GtkSnapshot`
106 	 *
107 	 * Throws: ConstructionException GTK+ fails to create the object.
108 	 */
109 	public this()
110 	{
111 		auto __p = gtk_snapshot_new();
112 
113 		if(__p is null)
114 		{
115 			throw new ConstructionException("null returned by new");
116 		}
117 
118 		this(cast(GtkSnapshot*) __p, true);
119 	}
120 
121 	/**
122 	 * Appends a stroked border rectangle inside the given @outline.
123 	 *
124 	 * The four sides of the border can have different widths and colors.
125 	 *
126 	 * Params:
127 	 *     outline = the outline of the border
128 	 *     borderWidth = the stroke width of the border on
129 	 *         the top, right, bottom and left side respectively.
130 	 *     borderColor = the color used on the top, right,
131 	 *         bottom and left side.
132 	 */
133 	public void appendBorder(RoundedRect outline, float[4] borderWidth, RGBA[4] borderColor)
134 	{
135 		GdkRGBA[] borderColorArray = new GdkRGBA[borderColor.length];
136 		for ( int i = 0; i < borderColor.length; i++ )
137 		{
138 			borderColorArray[i] = *(borderColor[i].getRGBAStruct());
139 		}
140 
141 		gtk_snapshot_append_border(gtkSnapshot, (outline is null) ? null : outline.getRoundedRectStruct(), borderWidth.ptr, borderColorArray.ptr);
142 	}
143 
144 	/**
145 	 * Creates a new [class@Gsk.CairoNode] and appends it to the current
146 	 * render node of @snapshot, without changing the current node.
147 	 *
148 	 * Params:
149 	 *     bounds = the bounds for the new node
150 	 *
151 	 * Returns: a `cairo_t` suitable for drawing the contents of
152 	 *     the newly created render node
153 	 */
154 	public Context appendCairo(Rect bounds)
155 	{
156 		auto __p = gtk_snapshot_append_cairo(gtkSnapshot, (bounds is null) ? null : bounds.getRectStruct());
157 
158 		if(__p is null)
159 		{
160 			return null;
161 		}
162 
163 		return new Context(cast(cairo_t*) __p);
164 	}
165 
166 	/**
167 	 * Creates a new render node drawing the @color into the
168 	 * given @bounds and appends it to the current render node
169 	 * of @snapshot.
170 	 *
171 	 * You should try to avoid calling this function if
172 	 * @color is transparent.
173 	 *
174 	 * Params:
175 	 *     color = the color to draw
176 	 *     bounds = the bounds for the new node
177 	 */
178 	public void appendColor(RGBA color, Rect bounds)
179 	{
180 		gtk_snapshot_append_color(gtkSnapshot, (color is null) ? null : color.getRGBAStruct(), (bounds is null) ? null : bounds.getRectStruct());
181 	}
182 
183 	/**
184 	 * Appends a conic gradient node with the given stops to @snapshot.
185 	 *
186 	 * Params:
187 	 *     bounds = the rectangle to render the gradient into
188 	 *     center = the center point of the conic gradient
189 	 *     rotation = the clockwise rotation in degrees of the starting angle.
190 	 *         0 means the starting angle is the top.
191 	 *     stops = the color stops defining the gradient
192 	 */
193 	public void appendConicGradient(Rect bounds, Point center, float rotation, GskColorStop[] stops)
194 	{
195 		gtk_snapshot_append_conic_gradient(gtkSnapshot, (bounds is null) ? null : bounds.getRectStruct(), (center is null) ? null : center.getPointStruct(), rotation, stops.ptr, cast(size_t)stops.length);
196 	}
197 
198 	/**
199 	 * Appends an inset shadow into the box given by @outline.
200 	 *
201 	 * Params:
202 	 *     outline = outline of the region surrounded by shadow
203 	 *     color = color of the shadow
204 	 *     dx = horizontal offset of shadow
205 	 *     dy = vertical offset of shadow
206 	 *     spread = how far the shadow spreads towards the inside
207 	 *     blurRadius = how much blur to apply to the shadow
208 	 */
209 	public void appendInsetShadow(RoundedRect outline, RGBA color, float dx, float dy, float spread, float blurRadius)
210 	{
211 		gtk_snapshot_append_inset_shadow(gtkSnapshot, (outline is null) ? null : outline.getRoundedRectStruct(), (color is null) ? null : color.getRGBAStruct(), dx, dy, spread, blurRadius);
212 	}
213 
214 	/** */
215 	public void appendLayout(PgLayout layout, RGBA color)
216 	{
217 		gtk_snapshot_append_layout(gtkSnapshot, (layout is null) ? null : layout.getPgLayoutStruct(), (color is null) ? null : color.getRGBAStruct());
218 	}
219 
220 	/**
221 	 * Appends a linear gradient node with the given stops to @snapshot.
222 	 *
223 	 * Params:
224 	 *     bounds = the rectangle to render the linear gradient into
225 	 *     startPoint = the point at which the linear gradient will begin
226 	 *     endPoint = the point at which the linear gradient will finish
227 	 *     stops = the color stops defining the gradient
228 	 */
229 	public void appendLinearGradient(Rect bounds, Point startPoint, Point endPoint, GskColorStop[] stops)
230 	{
231 		gtk_snapshot_append_linear_gradient(gtkSnapshot, (bounds is null) ? null : bounds.getRectStruct(), (startPoint is null) ? null : startPoint.getPointStruct(), (endPoint is null) ? null : endPoint.getPointStruct(), stops.ptr, cast(size_t)stops.length);
232 	}
233 
234 	/**
235 	 * Appends @node to the current render node of @snapshot,
236 	 * without changing the current node.
237 	 *
238 	 * If @snapshot does not have a current node yet, @node
239 	 * will become the initial node.
240 	 *
241 	 * Params:
242 	 *     node = a `GskRenderNode`
243 	 */
244 	public void appendNode(RenderNode node)
245 	{
246 		gtk_snapshot_append_node(gtkSnapshot, (node is null) ? null : node.getRenderNodeStruct());
247 	}
248 
249 	/**
250 	 * Appends an outset shadow node around the box given by @outline.
251 	 *
252 	 * Params:
253 	 *     outline = outline of the region surrounded by shadow
254 	 *     color = color of the shadow
255 	 *     dx = horizontal offset of shadow
256 	 *     dy = vertical offset of shadow
257 	 *     spread = how far the shadow spreads towards the outside
258 	 *     blurRadius = how much blur to apply to the shadow
259 	 */
260 	public void appendOutsetShadow(RoundedRect outline, RGBA color, float dx, float dy, float spread, float blurRadius)
261 	{
262 		gtk_snapshot_append_outset_shadow(gtkSnapshot, (outline is null) ? null : outline.getRoundedRectStruct(), (color is null) ? null : color.getRGBAStruct(), dx, dy, spread, blurRadius);
263 	}
264 
265 	/**
266 	 * Appends a radial gradient node with the given stops to @snapshot.
267 	 *
268 	 * Params:
269 	 *     bounds = the rectangle to render the readial gradient into
270 	 *     center = the center point for the radial gradient
271 	 *     hradius = the horizontal radius
272 	 *     vradius = the vertical radius
273 	 *     start = the start position (on the horizontal axis)
274 	 *     end = the end position (on the horizontal axis)
275 	 *     stops = the color stops defining the gradient
276 	 */
277 	public void appendRadialGradient(Rect bounds, Point center, float hradius, float vradius, float start, float end, GskColorStop[] stops)
278 	{
279 		gtk_snapshot_append_radial_gradient(gtkSnapshot, (bounds is null) ? null : bounds.getRectStruct(), (center is null) ? null : center.getPointStruct(), hradius, vradius, start, end, stops.ptr, cast(size_t)stops.length);
280 	}
281 
282 	/**
283 	 * Appends a repeating linear gradient node with the given stops to @snapshot.
284 	 *
285 	 * Params:
286 	 *     bounds = the rectangle to render the linear gradient into
287 	 *     startPoint = the point at which the linear gradient will begin
288 	 *     endPoint = the point at which the linear gradient will finish
289 	 *     stops = the color stops defining the gradient
290 	 */
291 	public void appendRepeatingLinearGradient(Rect bounds, Point startPoint, Point endPoint, GskColorStop[] stops)
292 	{
293 		gtk_snapshot_append_repeating_linear_gradient(gtkSnapshot, (bounds is null) ? null : bounds.getRectStruct(), (startPoint is null) ? null : startPoint.getPointStruct(), (endPoint is null) ? null : endPoint.getPointStruct(), stops.ptr, cast(size_t)stops.length);
294 	}
295 
296 	/**
297 	 * Appends a repeating radial gradient node with the given stops to @snapshot.
298 	 *
299 	 * Params:
300 	 *     bounds = the rectangle to render the readial gradient into
301 	 *     center = the center point for the radial gradient
302 	 *     hradius = the horizontal radius
303 	 *     vradius = the vertical radius
304 	 *     start = the start position (on the horizontal axis)
305 	 *     end = the end position (on the horizontal axis)
306 	 *     stops = the color stops defining the gradient
307 	 */
308 	public void appendRepeatingRadialGradient(Rect bounds, Point center, float hradius, float vradius, float start, float end, GskColorStop[] stops)
309 	{
310 		gtk_snapshot_append_repeating_radial_gradient(gtkSnapshot, (bounds is null) ? null : bounds.getRectStruct(), (center is null) ? null : center.getPointStruct(), hradius, vradius, start, end, stops.ptr, cast(size_t)stops.length);
311 	}
312 
313 	/**
314 	 * Creates a new render node drawing the @texture
315 	 * into the given @bounds and appends it to the
316 	 * current render node of @snapshot.
317 	 *
318 	 * Params:
319 	 *     texture = the texture to render
320 	 *     bounds = the bounds for the new node
321 	 */
322 	public void appendTexture(Texture texture, Rect bounds)
323 	{
324 		gtk_snapshot_append_texture(gtkSnapshot, (texture is null) ? null : texture.getTextureStruct(), (bounds is null) ? null : bounds.getRectStruct());
325 	}
326 
327 	/**
328 	 * Returns the node that was constructed by @snapshot
329 	 * and frees @snapshot.
330 	 *
331 	 * Returns: a newly-created [class@Gsk.RenderNode]
332 	 */
333 	public RenderNode freeToNode()
334 	{
335 		auto __p = gtk_snapshot_free_to_node(gtkSnapshot);
336 
337 		if(__p is null)
338 		{
339 			return null;
340 		}
341 
342 		return ObjectG.getDObject!(RenderNode)(cast(GskRenderNode*) __p, true);
343 	}
344 
345 	/**
346 	 * Returns a paintable for the node that was
347 	 * constructed by @snapshot and frees @snapshot.
348 	 *
349 	 * Params:
350 	 *     size = The size of the resulting paintable
351 	 *         or %NULL to use the bounds of the snapshot
352 	 *
353 	 * Returns: a newly-created [iface@Gdk.Paintable]
354 	 */
355 	public PaintableIF freeToPaintable(Size size)
356 	{
357 		auto __p = gtk_snapshot_free_to_paintable(gtkSnapshot, (size is null) ? null : size.getSizeStruct());
358 
359 		if(__p is null)
360 		{
361 			return null;
362 		}
363 
364 		return ObjectG.getDObject!(PaintableIF)(cast(GdkPaintable*) __p, true);
365 	}
366 
367 	/**
368 	 * Removes the top element from the stack of render nodes and
369 	 * adds it to the nearest [class@Gsk.GLShaderNode] below it.
370 	 *
371 	 * This must be called the same number of times as the number
372 	 * of textures is needed for the shader in
373 	 * [method@Gtk.Snapshot.push_gl_shader].
374 	 */
375 	public void glShaderPopTexture()
376 	{
377 		gtk_snapshot_gl_shader_pop_texture(gtkSnapshot);
378 	}
379 
380 	/**
381 	 * Applies a perspective projection transform.
382 	 *
383 	 * See [method@Gsk.Transform.perspective] for a discussion on the details.
384 	 *
385 	 * Params:
386 	 *     depth = distance of the z=0 plane
387 	 */
388 	public void perspective(float depth)
389 	{
390 		gtk_snapshot_perspective(gtkSnapshot, depth);
391 	}
392 
393 	/**
394 	 * Removes the top element from the stack of render nodes,
395 	 * and appends it to the node underneath it.
396 	 */
397 	public void pop()
398 	{
399 		gtk_snapshot_pop(gtkSnapshot);
400 	}
401 
402 	/**
403 	 * Blends together two images with the given blend mode.
404 	 *
405 	 * Until the first call to [method@Gtk.Snapshot.pop], the
406 	 * bottom image for the blend operation will be recorded.
407 	 * After that call, the top image to be blended will be
408 	 * recorded until the second call to [method@Gtk.Snapshot.pop].
409 	 *
410 	 * Calling this function requires two subsequent calls
411 	 * to [method@Gtk.Snapshot.pop].
412 	 *
413 	 * Params:
414 	 *     blendMode = blend mode to use
415 	 */
416 	public void pushBlend(GskBlendMode blendMode)
417 	{
418 		gtk_snapshot_push_blend(gtkSnapshot, blendMode);
419 	}
420 
421 	/**
422 	 * Blurs an image.
423 	 *
424 	 * The image is recorded until the next call to [method@Gtk.Snapshot.pop].
425 	 *
426 	 * Params:
427 	 *     radius = the blur radius to use. Must be positive
428 	 */
429 	public void pushBlur(double radius)
430 	{
431 		gtk_snapshot_push_blur(gtkSnapshot, radius);
432 	}
433 
434 	/**
435 	 * Clips an image to a rectangle.
436 	 *
437 	 * The image is recorded until the next call to [method@Gtk.Snapshot.pop].
438 	 *
439 	 * Params:
440 	 *     bounds = the rectangle to clip to
441 	 */
442 	public void pushClip(Rect bounds)
443 	{
444 		gtk_snapshot_push_clip(gtkSnapshot, (bounds is null) ? null : bounds.getRectStruct());
445 	}
446 
447 	/**
448 	 * Modifies the colors of an image by applying an affine transformation
449 	 * in RGB space.
450 	 *
451 	 * The image is recorded until the next call to [method@Gtk.Snapshot.pop].
452 	 *
453 	 * Params:
454 	 *     colorMatrix = the color matrix to use
455 	 *     colorOffset = the color offset to use
456 	 */
457 	public void pushColorMatrix(Matrix colorMatrix, Vec4 colorOffset)
458 	{
459 		gtk_snapshot_push_color_matrix(gtkSnapshot, (colorMatrix is null) ? null : colorMatrix.getMatrixStruct(), (colorOffset is null) ? null : colorOffset.getVec4Struct());
460 	}
461 
462 	/**
463 	 * Snapshots a cross-fade operation between two images with the
464 	 * given @progress.
465 	 *
466 	 * Until the first call to [method@Gtk.Snapshot.pop], the start image
467 	 * will be snapshot. After that call, the end image will be recorded
468 	 * until the second call to [method@Gtk.Snapshot.pop].
469 	 *
470 	 * Calling this function requires two subsequent calls
471 	 * to [method@Gtk.Snapshot.pop].
472 	 *
473 	 * Params:
474 	 *     progress = progress between 0.0 and 1.0
475 	 */
476 	public void pushCrossFade(double progress)
477 	{
478 		gtk_snapshot_push_cross_fade(gtkSnapshot, progress);
479 	}
480 
481 	/**
482 	 * Push a [class@Gsk.GLShaderNode].
483 	 *
484 	 * The node uses the given [class@Gsk.GLShader] and uniform values
485 	 * Additionally this takes a list of @n_children other nodes
486 	 * which will be passed to the [class@Gsk.GLShaderNode].
487 	 *
488 	 * The @take_args argument is a block of data to use for uniform
489 	 * arguments, as per types and offsets defined by the @shader.
490 	 * Normally this is generated by [method@Gsk.GLShader.format_args]
491 	 * or [struct@Gsk.ShaderArgsBuilder].
492 	 *
493 	 * The snapshotter takes ownership of @take_args, so the caller should
494 	 * not free it after this.
495 	 *
496 	 * If the renderer doesn't support GL shaders, or if there is any
497 	 * problem when compiling the shader, then the node will draw pink.
498 	 * You should use [method@Gsk.GLShader.compile] to ensure the @shader
499 	 * will work for the renderer before using it.
500 	 *
501 	 * If the shader requires textures (see [method@Gsk.GLShader.get_n_textures]),
502 	 * then it is expected that you call [method@Gtk.Snapshot.gl_shader_pop_texture]
503 	 * the number of times that are required. Each of these calls will generate
504 	 * a node that is added as a child to the `GskGLShaderNode`, which in turn
505 	 * will render these offscreen and pass as a texture to the shader.
506 	 *
507 	 * Once all textures (if any) are pop:ed, you must call the regular
508 	 * [method@Gtk.Snapshot.pop].
509 	 *
510 	 * If you want to use pre-existing textures as input to the shader rather
511 	 * than rendering new ones, use [method@Gtk.Snapshot.append_texture] to
512 	 * push a texture node. These will be used directly rather than being
513 	 * re-rendered.
514 	 *
515 	 * For details on how to write shaders, see [class@Gsk.GLShader].
516 	 *
517 	 * Params:
518 	 *     shader = The code to run
519 	 *     bounds = the rectangle to render into
520 	 *     takeArgs = Data block with arguments for the shader.
521 	 */
522 	public void pushGlShader(GLShader shader, Rect bounds, Bytes takeArgs)
523 	{
524 		gtk_snapshot_push_gl_shader(gtkSnapshot, (shader is null) ? null : shader.getGLShaderStruct(), (bounds is null) ? null : bounds.getRectStruct(), (takeArgs is null) ? null : takeArgs.getBytesStruct(true));
525 	}
526 
527 	/**
528 	 * Modifies the opacity of an image.
529 	 *
530 	 * The image is recorded until the next call to [method@Gtk.Snapshot.pop].
531 	 *
532 	 * Params:
533 	 *     opacity = the opacity to use
534 	 */
535 	public void pushOpacity(double opacity)
536 	{
537 		gtk_snapshot_push_opacity(gtkSnapshot, opacity);
538 	}
539 
540 	/**
541 	 * Creates a node that repeats the child node.
542 	 *
543 	 * The child is recorded until the next call to [method@Gtk.Snapshot.pop].
544 	 *
545 	 * Params:
546 	 *     bounds = the bounds within which to repeat
547 	 *     childBounds = the bounds of the child or %NULL
548 	 *         to use the full size of the collected child node
549 	 */
550 	public void pushRepeat(Rect bounds, Rect childBounds)
551 	{
552 		gtk_snapshot_push_repeat(gtkSnapshot, (bounds is null) ? null : bounds.getRectStruct(), (childBounds is null) ? null : childBounds.getRectStruct());
553 	}
554 
555 	/**
556 	 * Clips an image to a rounded rectangle.
557 	 *
558 	 * The image is recorded until the next call to [method@Gtk.Snapshot.pop].
559 	 *
560 	 * Params:
561 	 *     bounds = the rounded rectangle to clip to
562 	 */
563 	public void pushRoundedClip(RoundedRect bounds)
564 	{
565 		gtk_snapshot_push_rounded_clip(gtkSnapshot, (bounds is null) ? null : bounds.getRoundedRectStruct());
566 	}
567 
568 	/**
569 	 * Applies a shadow to an image.
570 	 *
571 	 * The image is recorded until the next call to [method@Gtk.Snapshot.pop].
572 	 *
573 	 * Params:
574 	 *     shadow = the first shadow specification
575 	 */
576 	public void pushShadow(GskShadow[] shadow)
577 	{
578 		gtk_snapshot_push_shadow(gtkSnapshot, shadow.ptr, cast(size_t)shadow.length);
579 	}
580 
581 	/**
582 	 * Creates a render node for the CSS background according to @context,
583 	 * and appends it to the current node of @snapshot, without changing
584 	 * the current node.
585 	 *
586 	 * Params:
587 	 *     context = the style context that defines the background
588 	 *     x = X origin of the rectangle
589 	 *     y = Y origin of the rectangle
590 	 *     width = rectangle width
591 	 *     height = rectangle height
592 	 */
593 	public void renderBackground(StyleContext context, double x, double y, double width, double height)
594 	{
595 		gtk_snapshot_render_background(gtkSnapshot, (context is null) ? null : context.getStyleContextStruct(), x, y, width, height);
596 	}
597 
598 	/**
599 	 * Creates a render node for the focus outline according to @context,
600 	 * and appends it to the current node of @snapshot, without changing
601 	 * the current node.
602 	 *
603 	 * Params:
604 	 *     context = the style context that defines the focus ring
605 	 *     x = X origin of the rectangle
606 	 *     y = Y origin of the rectangle
607 	 *     width = rectangle width
608 	 *     height = rectangle height
609 	 */
610 	public void renderFocus(StyleContext context, double x, double y, double width, double height)
611 	{
612 		gtk_snapshot_render_focus(gtkSnapshot, (context is null) ? null : context.getStyleContextStruct(), x, y, width, height);
613 	}
614 
615 	/**
616 	 * Creates a render node for the CSS border according to @context,
617 	 * and appends it to the current node of @snapshot, without changing
618 	 * the current node.
619 	 *
620 	 * Params:
621 	 *     context = the style context that defines the frame
622 	 *     x = X origin of the rectangle
623 	 *     y = Y origin of the rectangle
624 	 *     width = rectangle width
625 	 *     height = rectangle height
626 	 */
627 	public void renderFrame(StyleContext context, double x, double y, double width, double height)
628 	{
629 		gtk_snapshot_render_frame(gtkSnapshot, (context is null) ? null : context.getStyleContextStruct(), x, y, width, height);
630 	}
631 
632 	/**
633 	 * Draws a text caret using @snapshot at the specified index of @layout.
634 	 *
635 	 * Params:
636 	 *     context = a `GtkStyleContext`
637 	 *     x = X origin
638 	 *     y = Y origin
639 	 *     layout = the `PangoLayout` of the text
640 	 *     index = the index in the `PangoLayout`
641 	 *     direction = the `PangoDirection` of the text
642 	 */
643 	public void renderInsertionCursor(StyleContext context, double x, double y, PgLayout layout, int index, PangoDirection direction)
644 	{
645 		gtk_snapshot_render_insertion_cursor(gtkSnapshot, (context is null) ? null : context.getStyleContextStruct(), x, y, (layout is null) ? null : layout.getPgLayoutStruct(), index, direction);
646 	}
647 
648 	/**
649 	 * Creates a render node for rendering @layout according to the style
650 	 * information in @context, and appends it to the current node of @snapshot,
651 	 * without changing the current node.
652 	 *
653 	 * Params:
654 	 *     context = the style context that defines the text
655 	 *     x = X origin of the rectangle
656 	 *     y = Y origin of the rectangle
657 	 *     layout = the `PangoLayout` to render
658 	 */
659 	public void renderLayout(StyleContext context, double x, double y, PgLayout layout)
660 	{
661 		gtk_snapshot_render_layout(gtkSnapshot, (context is null) ? null : context.getStyleContextStruct(), x, y, (layout is null) ? null : layout.getPgLayoutStruct());
662 	}
663 
664 	/**
665 	 * Restores @snapshot to the state saved by a preceding call to
666 	 * [method@Snapshot.save] and removes that state from the stack of
667 	 * saved states.
668 	 */
669 	public void restore()
670 	{
671 		gtk_snapshot_restore(gtkSnapshot);
672 	}
673 
674 	/**
675 	 * Rotates @@snapshot's coordinate system by @angle degrees in 2D space -
676 	 * or in 3D speak, rotates around the Z axis.
677 	 *
678 	 * To rotate around other axes, use [method@Gsk.Transform.rotate_3d].
679 	 *
680 	 * Params:
681 	 *     angle = the rotation angle, in degrees (clockwise)
682 	 */
683 	public void rotate(float angle)
684 	{
685 		gtk_snapshot_rotate(gtkSnapshot, angle);
686 	}
687 
688 	/**
689 	 * Rotates @snapshot's coordinate system by @angle degrees around @axis.
690 	 *
691 	 * For a rotation in 2D space, use [method@Gsk.Transform.rotate].
692 	 *
693 	 * Params:
694 	 *     angle = the rotation angle, in degrees (clockwise)
695 	 *     axis = The rotation axis
696 	 */
697 	public void rotate3d(float angle, Vec3 axis)
698 	{
699 		gtk_snapshot_rotate_3d(gtkSnapshot, angle, (axis is null) ? null : axis.getVec3Struct());
700 	}
701 
702 	/**
703 	 * Makes a copy of the current state of @snapshot and saves it
704 	 * on an internal stack.
705 	 *
706 	 * When [method@Gtk.Snapshot.restore] is called, @snapshot will
707 	 * be restored to the saved state. Multiple calls to
708 	 * [method@Snapshot.save] and [class@Snapshot.restore] can be nested;
709 	 * each call to `gtk_snapshot_restore()` restores the state from
710 	 * the matching paired `gtk_snapshot_save()`.
711 	 *
712 	 * It is necessary to clear all saved states with corresponding
713 	 * calls to `gtk_snapshot_restore()`.
714 	 */
715 	public void save()
716 	{
717 		gtk_snapshot_save(gtkSnapshot);
718 	}
719 
720 	/**
721 	 * Scales @snapshot's coordinate system in 2-dimensional space by
722 	 * the given factors.
723 	 *
724 	 * Use [method@Gtk.Snapshot.scale_3d] to scale in all 3 dimensions.
725 	 *
726 	 * Params:
727 	 *     factorX = scaling factor on the X axis
728 	 *     factorY = scaling factor on the Y axis
729 	 */
730 	public void scale(float factorX, float factorY)
731 	{
732 		gtk_snapshot_scale(gtkSnapshot, factorX, factorY);
733 	}
734 
735 	/**
736 	 * Scales @snapshot's coordinate system by the given factors.
737 	 *
738 	 * Params:
739 	 *     factorX = scaling factor on the X axis
740 	 *     factorY = scaling factor on the Y axis
741 	 *     factorZ = scaling factor on the Z axis
742 	 */
743 	public void scale3d(float factorX, float factorY, float factorZ)
744 	{
745 		gtk_snapshot_scale_3d(gtkSnapshot, factorX, factorY, factorZ);
746 	}
747 
748 	/**
749 	 * Returns the render node that was constructed
750 	 * by @snapshot.
751 	 *
752 	 * After calling this function, it is no longer possible to
753 	 * add more nodes to @snapshot. The only function that should
754 	 * be called after this is [method@GObject.Object.unref].
755 	 *
756 	 * Returns: the constructed `GskRenderNode`
757 	 */
758 	public RenderNode toNode()
759 	{
760 		auto __p = gtk_snapshot_to_node(gtkSnapshot);
761 
762 		if(__p is null)
763 		{
764 			return null;
765 		}
766 
767 		return ObjectG.getDObject!(RenderNode)(cast(GskRenderNode*) __p, true);
768 	}
769 
770 	/**
771 	 * Returns a paintable encapsulating the render node
772 	 * that was constructed by @snapshot.
773 	 *
774 	 * After calling this function, it is no longer possible to
775 	 * add more nodes to @snapshot. The only function that should
776 	 * be called after this is [method@GObject.Object.unref].
777 	 *
778 	 * Params:
779 	 *     size = The size of the resulting paintable
780 	 *         or %NULL to use the bounds of the snapshot
781 	 *
782 	 * Returns: a new `GdkPaintable`
783 	 */
784 	public PaintableIF toPaintable(Size size)
785 	{
786 		auto __p = gtk_snapshot_to_paintable(gtkSnapshot, (size is null) ? null : size.getSizeStruct());
787 
788 		if(__p is null)
789 		{
790 			return null;
791 		}
792 
793 		return ObjectG.getDObject!(PaintableIF)(cast(GdkPaintable*) __p, true);
794 	}
795 
796 	/**
797 	 * Transforms @snapshot's coordinate system with the given @transform.
798 	 *
799 	 * Params:
800 	 *     transform = the transform to apply
801 	 */
802 	public void transform(Transform transform)
803 	{
804 		gtk_snapshot_transform(gtkSnapshot, (transform is null) ? null : transform.getTransformStruct());
805 	}
806 
807 	/**
808 	 * Transforms @snapshot's coordinate system with the given @matrix.
809 	 *
810 	 * Params:
811 	 *     matrix = the matrix to multiply the transform with
812 	 */
813 	public void transformMatrix(Matrix matrix)
814 	{
815 		gtk_snapshot_transform_matrix(gtkSnapshot, (matrix is null) ? null : matrix.getMatrixStruct());
816 	}
817 
818 	/**
819 	 * Translates @snapshot's coordinate system by @point in 2-dimensional space.
820 	 *
821 	 * Params:
822 	 *     point = the point to translate the snapshot by
823 	 */
824 	public void translate(Point point)
825 	{
826 		gtk_snapshot_translate(gtkSnapshot, (point is null) ? null : point.getPointStruct());
827 	}
828 
829 	/**
830 	 * Translates @snapshot's coordinate system by @point.
831 	 *
832 	 * Params:
833 	 *     point = the point to translate the snapshot by
834 	 */
835 	public void translate3d(Point3D point)
836 	{
837 		gtk_snapshot_translate_3d(gtkSnapshot, (point is null) ? null : point.getPoint3DStruct());
838 	}
839 }